package com.example.domain.repository;

import com.example.domain.db.entity.SysLogExample;
import com.example.domain.db.entity.SysLogPO;
import com.example.domain.db.mapper.SysLogMapper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

@Repository
public class SysLogRepository {
    @Resource
    private SysLogMapper sysLogMapper;

    public List<SysLogPO> queryList() {
        SysLogExample example = new SysLogExample();
        example.setPageIndex(1);
        example.setPageSize(10);
        example.setFields("log_id,api_path,api_name,api_method");
        SysLogExample.Criteria criteria = example.createCriteria();
        criteria.andUserIdEqualTo(1000L);

        return sysLogMapper.selectByExample(example);
    }

    public SysLogPO queryById(Long logId) {
        return sysLogMapper.selectByPrimaryKey(logId);
    }

    public Integer deleteById(Long logId) {
        return sysLogMapper.deleteByPrimaryKey(logId);
    }
}
